Skip to content

[https://nvbugs/6501376][fix] Test-only fix — drop the if hidden_size % 2 != 0: with pytest.raises(...)#16844

Open
trtllm-agent wants to merge 4 commits into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6501376
Open

[https://nvbugs/6501376][fix] Test-only fix — drop the if hidden_size % 2 != 0: with pytest.raises(...)#16844
trtllm-agent wants to merge 4 commits into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6501376

Conversation

@trtllm-agent

@trtllm-agent trtllm-agent commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: Stale pytest.raises(AssertionError) on the odd-hidden_size branch expected a divisibility assert that PR [TRTLLM-13117][feat] Implement Uneven TP Linear for VisualGen models #14875's _auto_tp_sharding no longer fires for VANILLA row/column Linear.
  • Fix: Test-only fix — drop the if hidden_size % 2 != 0: with pytest.raises(...) branch in both test_row_linear and test_column_linear; unconditionally for r in results: assert r is True.
  • Automated fix generated by repair-bot

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Dev Engineer Review

  • Updated tensorrt_llm/_torch/modules/linear.py to correctly handle gather_output=True for VANILLA TensorParallelMode.COLUMN when _auto_tp_sharding produces uneven per-rank shard widths:
    • Added _tp_sharding_is_auto tracking to distinguish whether tp_sharding came from _auto_tp_sharding vs override_tp_sharding.
    • Extended gather_output_sizes (default None) to store per-rank allgather sizes when uneven widths are detected.
    • Updated _auto_tp_sharding(..., rank=...) to accept an optional rank argument so shard boundaries can be queried for other ranks.
    • In forward for COLUMN + gather_output=True, passed sizes=self.gather_output_sizes into the COLUMN allgather to avoid relying on shape inference.
    • Added validation rejecting incompatible combinations of gather_output with override_tp_sharding (via a ValueError), aligning with the referenced bug about this unsupported mode combination.
  • Updated tests/unittest/_torch/multi_gpu/test_linear.py:
    • Removed conditional pytest.raises(AssertionError) expectations for “unbalanced/odd” hidden_size in both test_column_linear and test_row_linear.
    • Tests now always iterate through results and assert each rank returns True, reflecting the post-[TRTLLM-13117][feat] Implement Uneven TP Linear for VisualGen models #14875 behavior where _auto_tp_sharding no longer triggers that assertion for odd hidden sizes.

QA Engineer Review

  • Modified test code (tests/unittest/_torch/multi_gpu/test_linear.py):
    • Modified: test_column_linear (removed conditional failure expectation; now asserts True for all ranks)
    • Modified: test_row_linear (removed conditional failure expectation; now asserts True for all ranks)
  • Modified test-list file (tests/integration/test_lists/waives.txt):
    • Removed SKIP entries:
      • unittest/_torch/multi_gpu/test_linear.py::test_column_linear[2-unbalanced]
      • unittest/_torch/multi_gpu/test_linear.py::test_row_linear[2-unbalanced]
  • Verdict: needs follow-up (CI was mentioned as triggered/aborted/killed, but no CBTS coverage data or test failure details were provided in the context).

…mn linear

PR NVIDIA#14875 added VANILLA-mode uneven-TP support in
tensorrt_llm/_torch/modules/linear.py via _auto_tp_sharding, so
test_row_linear[2-unbalanced] (hidden=15) and test_column_linear
[2-unbalanced] (hidden=127) no longer hit the divisibility assert.
The pre-existing tests still expected an AssertionError on the
odd branch, producing "Failed: DID NOT RAISE" in pre-merge CI.
Unconditionally assert all ranks return True.

Signed-off-by: handongl <handongl@nvidia.com>
@trtllm-agent
trtllm-agent requested a review from a team as a code owner July 24, 2026 16:59
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 044fdaeb-bdbb-411f-a289-d8a1e6c62ff4

📥 Commits

Reviewing files that changed from the base of the PR and between 3c09b66 and eb39108.

📒 Files selected for processing (1)
  • tensorrt_llm/_torch/modules/linear.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tensorrt_llm/_torch/modules/linear.py

Walkthrough

Linear now computes per-rank sizes for uneven column-parallel outputs and supplies them to allgather. Multi-GPU column and row linear tests no longer expect failures for odd hidden sizes, and related skip waivers are removed.

Changes

Uneven linear sharding

Layer / File(s) Summary
Compute and apply uneven gather sizes
tensorrt_llm/_torch/modules/linear.py
Linear tracks auto-generated sharding, derives per-rank output widths, validates unsupported overrides, and passes sizes to column allgather.
Enable unbalanced linear tests
tests/unittest/_torch/multi_gpu/test_linear.py, tests/integration/test_lists/waives.txt
Column and row tests now require successful results for odd hidden sizes, and their skip waivers are removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LinearInit
  participant AutoTPSharding
  participant LinearForward
  participant Allgather
  LinearInit->>AutoTPSharding: Query per-rank shard widths
  AutoTPSharding-->>LinearInit: Return shard boundaries
  LinearForward->>Allgather: Pass gather_output_sizes
  Allgather-->>LinearForward: Gather uneven column outputs
Loading

Possibly related PRs

Suggested labels: VisualGen

Suggested reviewers: qijune, xinhe-nv, brnguyen2, bowenfu, jieli-matrix

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the fix and test plan, but it omits the required Description, Test Coverage, and PR Checklist sections from the template. Add the missing template sections: Description, Test Coverage, and PR Checklist, and fill them out with a brief issue/solution summary and validation details.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is clearly related to the change and identifies the bug fix, though it is longer and less concise than ideal.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: junq <22017000+QiJune@users.noreply.github.com>
@QiJune

QiJune commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

/bot run

@QiJune
QiJune enabled auto-merge (squash) July 25, 2026 12:48
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61699 [ run ] triggered by Bot. Commit: 736fc59 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61699 [ run ] completed with state FAILURE. Commit: 736fc59
/LLM/main/L0_MergeRequest_PR pipeline #49904 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@lori-ren

Copy link
Copy Markdown
Contributor

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61711 [ run ] triggered by Bot. Commit: 736fc59 Link to invocation

@lori-ren

Copy link
Copy Markdown
Contributor

/bot help

@github-actions

Copy link
Copy Markdown

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental) --high-priority]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Supports wildcard * for pattern matching (e.g., "*PerfSanity*" matches all stages containing PerfSanity). Examples: "A10-PyTorch-1, xxx", "PerfSanity". The patterns "*", "*Post-Merge*", and "*PerfSanity*", including equivalent escaped or repeated-star forms and their use in comma-separated lists, require the ci: post-merge approved PR label. Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline. Requires the ci: post-merge approved PR label applied by an active member of NVIDIA/trt-llm-ci-approvers. The approval label remains in place when new commits are pushed.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Supports wildcard * for pattern matching. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx", --extra-stage "Post-Merge". The patterns "*", "*Post-Merge*", and "*PerfSanity*", including equivalent escaped or repeated-star forms and their use in comma-separated lists, require the ci: post-merge approved PR label.

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

--high-priority (OPTIONAL) : Run the pipeline with high priority. This option is restricted to authorized users only and will route the job to a high-priority queue.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@lori-ren

Copy link
Copy Markdown
Contributor

/bot kill

…allgather

Signed-off-by: Lori Ren <lorir@nvidia.com>
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61714 [ kill ] triggered by Bot. Commit: 736fc59 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61711 [ run ] completed with state ABORTED. Commit: 736fc59

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61714 [ kill ] completed with state SUCCESS. Commit: 736fc59
Successfully killed previous jobs for commit 736fc59

Link to invocation

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tensorrt_llm/_torch/modules/linear.py (1)

3415-3415: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Annotate the expanded helper signature.

Add precise parameter and return annotations to _auto_tp_sharding, including the new optional rank argument.

As per coding guidelines, every function must be annotated.

Proposed signature
-    def _auto_tp_sharding(self, features, quant_config, rank=None):
+    def _auto_tp_sharding(
+        self,
+        features: int,
+        quant_config: Optional[QuantConfig],
+        rank: Optional[int] = None,
+    ) -> tuple[int, int]:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tensorrt_llm/_torch/modules/linear.py` at line 3415, Annotate the
_auto_tp_sharding method signature with precise types for features,
quant_config, and the optional rank parameter, and add its return annotation.
Use the existing project type conventions and ensure rank’s optionality is
explicitly represented.

Sources: Coding guidelines, Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tensorrt_llm/_torch/modules/linear.py`:
- Around line 3353-3360: Extend the gather_output validation around the tuple
check to handle dictionary-based self.tp_sharding overrides as well. When
dictionary sharding produces uneven local widths, either derive a complete
per-rank sizes list and pass it to allgather via gather_output_sizes, or raise
ValueError for the unsupported case; do not leave gather_output_sizes unset and
allow equal-width assumptions.

---

Nitpick comments:
In `@tensorrt_llm/_torch/modules/linear.py`:
- Line 3415: Annotate the _auto_tp_sharding method signature with precise types
for features, quant_config, and the optional rank parameter, and add its return
annotation. Use the existing project type conventions and ensure rank’s
optionality is explicitly represented.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 248bddb6-20d7-4efa-8400-9eb5536a9bcb

📥 Commits

Reviewing files that changed from the base of the PR and between 736fc59 and 3c09b66.

📒 Files selected for processing (1)
  • tensorrt_llm/_torch/modules/linear.py

Comment thread tensorrt_llm/_torch/modules/linear.py Outdated
…sharding

Signed-off-by: Lori Ren <lorir@nvidia.com>
@lori-ren

Copy link
Copy Markdown
Contributor

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61716 [ run ] triggered by Bot. Commit: eb39108 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61716 [ run ] completed with state SUCCESS. Commit: eb39108
/LLM/main/L0_MergeRequest_PR pipeline #49920 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@lori-ren

Copy link
Copy Markdown
Contributor

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61721 [ run ] triggered by Bot. Commit: eb39108 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61721 [ run ] completed with state FAILURE. Commit: eb39108
/LLM/main/L0_MergeRequest_PR pipeline #49925 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@lori-ren

Copy link
Copy Markdown
Contributor

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61732 [ run ] triggered by Bot. Commit: eb39108 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61732 [ run ] completed with state FAILURE. Commit: eb39108
/LLM/main/L0_MergeRequest_PR pipeline #49935 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@lori-ren

Copy link
Copy Markdown
Contributor

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61742 [ run ] triggered by Bot. Commit: eb39108 Link to invocation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants